<?php namespace Admin\Controller;
use Hdphp\Controller\Controller;
class TypeController extends CommonController{
	private $model;
	//连接表
	public function __auto(){
		$this->model=new \Admin\Model\Type;
	}
	//显示列表
	public function index(){
		$typeData=$this->model->get();
		View::with('typeData',$typeData);
		View::make();
	}
	//添加方法
	public function add(){
		if(IS_POST){
			if($this->model->store()){
				View::success('添加成功',U('Type/index'));
			}
			View::error($this->model->getError());
		}
		View::make();
	}
	public function del(){
		$aid=Q('post.aid',0,'intval');
		if($this->model->del($aid)){
			View::success('删除成功',U('Type/index'));
		}
		View::error($this->model->getError());
	}
}


 ?>